﻿using Pdelvo.Minecraft.Network;

namespace Pdelvo.Minecraft.Protocol.Packets
{
    /// <summary>
    /// 
    /// </summary>
    /// <remarks></remarks>
    public class AttachEntity : Packet
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="AttachEntity"/> class.
        /// </summary>
        /// <remarks></remarks>
        public AttachEntity()
        {
            Code = 0x27;
        }

        /// <summary>
        /// Gets or sets the entity ID.
        /// </summary>
        /// <value>The entity ID.</value>
        /// <remarks></remarks>
        public int EntityID { get; set; }
        /// <summary>
        /// Gets or sets the vehicle ID.
        /// </summary>
        /// <value>The vehicle ID.</value>
        /// <remarks></remarks>
        public int VehicleID { get; set; }

        /// <summary>
        /// Receives the specified reader.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="version">The version.</param>
        /// <remarks></remarks>
        public override void Receive(BigEndianStream reader, int version)
        {
            EntityID = reader.ReadInt();
            VehicleID = reader.ReadInt();
        }

        /// <summary>
        /// Sends the specified writer.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="version">The version.</param>
        /// <remarks></remarks>
        protected override void Send(BigEndianStream writer, int version)
        {
            writer.Write(Code);
            writer.Write(EntityID);
            writer.Write(VehicleID);
        }
    }
}